import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)


export default new Vuex.Store({
    state:{
        user:{
            username:(localStorage.getItem('user')=="null"||localStorage.getItem('user')==null||localStorage.getItem('user')=='')?'尚未登录':JSON.parse(localStorage.getItem('user')).username
            },
        rs:[]
    },mutations:{
            login(store,user){
                store.user = user;
                localStorage.setItem('user',JSON.stringify(user));
            },initMenu(store,routers){
                store.rs = routers;
            }
    }
})